// 检测客户端平台类型
export function getClientType() {
    const userAgent = navigator.userAgent.toLowerCase();

    if (userAgent.includes('android')) {
        return 'Android';
    } else if (userAgent.includes('mac os')) {
        return 'mac';
    } else if (userAgent.includes('windows')) {
        return 'windows';
    } else {
        // 默认返回浏览器类型
        return 'browser';
    }
}

// 生成随机client_id (UUID v4简化版)
export function generateClientId() {
    return 'xxxxxxxx'.replace(/[xy]/g, function(c) {
        const r = Math.random() * 16 | 0;
        const v = c === 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
}

